Skip to content

runtime: add PresetBuilder::with_components escape hatch - #530

Merged
mfw78 merged 2 commits into
dev/m1from
feat/509-preset-with-components
Jul 23, 2026
Merged

runtime: add PresetBuilder::with_components escape hatch#530
mfw78 merged 2 commits into
dev/m1from
feat/509-preset-with-components

Conversation

@mfw78

@mfw78 mfw78 commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

What

Add PresetBuilder::with_components in crates/nexum-runtime/src/builder.rs, the preset-path mirror of the value-bound TypedBuilder::with_components.

It gathers the preset's extensions (plus any appended ones) and its add-ons before consuming the preset via components(), hands the preset's ComponentsBuilder to a caller-supplied FnOnce that returns the builders to open, and transitions to a new PresetComponentsBuilder<'a, T, C, S, E, L> stage whose launch() opens the overridden backends and drives LaunchRuntime::launch exactly as PresetBuilder::launch does.

An embedder can now swap any of the chain, store, ext, or logs seams straight from the preset shortcut, for example .with_runtime(P).with_components(|c| c.with_logs(...)).launch(), while the preset's extensions and add-ons carry through unchanged.

Why

The preset shortcut previously locked in all four component builders, so reaching a single seam meant dropping the preset entirely and rebuilding the lattice by hand. This closes that gap on the preset path and keeps parity with TypedBuilder::with_components.

Testing

  • cargo fmt --all -- --check clean.
  • cargo clean -p nexum-runtime then cargo clippy -p nexum-runtime --all-targets --all-features -- -D warnings clean after a forced recompile.
  • cargo test -p nexum-runtime --all-features 310 passed, 0 failed, 0 ignored, plus 1 doctest.
  • New preset_with_components_overrides_a_seam proves the substituted logs builder drives the launch's component build exactly once, then the launch bails on the empty module set.
  • New e2e_preset_with_components_launches_through_overridden_logs runs a full preset-path launch reading the overridden pipeline and stops it via the trigger-to-wait handshake; it skips when the example.wasm fixture is not built.

All commands run under nix develop on the CI-pinned rustc 1.94.0.

AI Assistance

Implemented, reviewed and verified with Claude Code (Opus).

Closes #509

…ent seams

Add PresetBuilder::with_components, mapping the preset's ComponentsBuilder
to the builders to open so an embedder overrides one seam (chain, store,
ext, or logs) while the preset's extensions and add-ons carry through. The
new PresetComponentsBuilder stage gathers those before consuming the preset
and launches otherwise as PresetBuilder::launch.
@mfw78
mfw78 force-pushed the feat/509-preset-with-components branch from bb9485d to 0541452 Compare July 23, 2026 14:15
@mfw78
mfw78 changed the base branch from feat/m5-pre-carve-runbook to dev/m1 July 23, 2026 14:15
…ents e2e

The manifest path derived from wasm.ancestors().nth(3) resolved to
<root>/target, so the explicit manifest pointed at a nonexistent file and
the loader silently fell back to an anonymous module. Derive the repo root
once and reuse it for both the wasm fixture and the manifest.
@mfw78
mfw78 force-pushed the feat/509-preset-with-components branch from 0541452 to 974a18f Compare July 23, 2026 14:52
@mfw78
mfw78 merged commit 06f820b into dev/m1 Jul 23, 2026
7 checks passed
@mfw78
mfw78 deleted the feat/509-preset-with-components branch July 23, 2026 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant